SG Window
Creating Windows

©1998 by Stinga

Reference     Constants     Error Codes     How To...     FAQ

SG Window enables you to create a window from within VB code. To create a window you canl use Create method of the Window object.

The kind (class) of a window and window attributes are specified with the parameters of the Create method. These parameters are:

className Name of the window class. className can be one of the predefined Win32 class names or it can be a string returned from RegisterClass method.
windowText Window text.
style Window style. Can be combination of style constants defined in the WinStyle enumeration
styleEx Window extended style. Can be combination of style constants defined in the WinStyleEx enumeration
x Window left coordinate. In pixels an relative to the parent window client rectangle.
y Window top coordinate. In pixels an relative to the parent window client rectangle.
width Window width. In pixels.
height Window height. In pixels.
hwndParent Parent window handle.
menuOrID Menu handle, or child-window identifier.

If you pass empty string for className parameter, SG Window will register new class and create window with that class. In this case you are responsible for handling all messages for the created window becasue there is no default window procedure. clsWindow class in the sgWindow.vbp example from your SG Window samples folder shows how you can do it.

For more info please refer to CreateWindow function in Win32 API documetation.

Example

Folowing example creates list view control:

Private wnd As SGWindow.Window

Sub Form_OnLoad()
   set wnd = New SGWindow.Window
   wnd.Create "SysListView32", "", _
       ws_CHILD + ws_BORDER + ws_VISIBLE, _
       0, 10, 10, 400, 300, Me.HWND, 1234
End Sub